package com.yzt.minemodule.dialog;

import android.view.View;

import com.yzt.zhuju.dialog.BottomBaseDialog;
import com.yzt.minemodule.R;

/**
 * 作者：bobwang
 * 创建时间：2023-11-12 23:45:24
 * 描述：
 */
public class GenderCheckDialog extends BottomBaseDialog {
    @Override
    public int getLayoutRes() {
        return R.layout.dialog_gender_check;
    }

    @Override
    public void bindView(View v) {

        findViewById(R.id.tv_gender_girl).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (genderCheckClickListener != null) {
                    genderCheckClickListener.onGenderCheck(2);
                }
                dismissAllowingStateLoss();
            }
        });
        findViewById(R.id.tv_gender_boy).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (genderCheckClickListener != null) {
                    genderCheckClickListener.onGenderCheck(1);
                }
                dismissAllowingStateLoss();
            }
        });
        findViewById(R.id.tv_cancel).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismissAllowingStateLoss();
            }
        });
    }

    private GenderCheckClickListener genderCheckClickListener;

    public void setGenderCheckClickListener(GenderCheckClickListener listener) {
        if (genderCheckClickListener == null) {
            genderCheckClickListener = listener;
        }
    }

    public interface GenderCheckClickListener {

        void onGenderCheck(int gender);
    }
}
